package com.householditemtwo.index.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.householditemtwo.common.entity.Carousel;
import com.householditemtwo.common.entity.Compary;
import com.householditemtwo.common.entity.Designer;
import com.householditemtwo.common.entity.News;
import com.householditemtwo.common.utils.BaseServlet;
import com.householditemtwo.index.dao.AboutDao;

/*
 * 跳转到页面
 *
 */
@WebServlet("/AboutServlet")
public class AboutServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;

	// 创建DAo
	AboutDao dao = new AboutDao();
		/**
		 * 跳转到首页
		 * @param request
		 * @param response
		 * @throws ServletException
		 * @throws IOException
		 */
	public void toAbout(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		
		//轮播图
		
		List<Carousel> carouselList=dao.selectAllCarousel();
			
		//调用DAO查询出公司信息
		List<Compary> comList=dao.selectCompary();
		
		
		//调用DAO查询出设计师信息
		List<Designer> desList=dao.selectDesigner();
		
		//把公司信息保存到request里面
		request.setAttribute("com", comList.get(0));
		
		//把设计师信息保存到request里面
		request.setAttribute("desList", desList);
		
		
		//轮播图
		request.setAttribute("carouselList", carouselList);
		
		
		
		//转发到关于我们首页
		
		
		request.getRequestDispatcher("about.jsp").forward(request, response);
	}

}
